package com.example.membersteward.enums;

public enum UserStatus {
    INACTIVE("0","未激活"),
    NORMAL("1","正常"),
    DISABLED("2","禁用");

    private final String code;


    private final String msg;


    UserStatus(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static String getCodeByMsg(String msg) {
        for (UserStatus status : UserStatus.values()) {
            if (status.getMsg().equals(msg)) {
                return status.getCode();
            }
        }
        return null;
    }

    public static String getMsgByCode(String code) {
        for (UserStatus status : UserStatus.values()) {
            if (status.getCode().equals(code)) {
                return status.getMsg();
            }
        }
        return null;
    }
}
